package com.six.apidemic.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import androidx.fragment.app.Fragment;

import com.six.apidemic.util.LogUtils;

/**
 * @author Administrator
 */
public abstract class BaseFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saveInstanceState) {
        View view = inflater.inflate(findLayoutId(), container, false);
        initView(view);
        return view;
    }
    protected abstract void initView(View view);

    /**
     * 获取xml
     *
     * @return
     */
    protected abstract int findLayoutId();

    @Override
    public void onHiddenChanged(boolean hidden) {
        LogUtils.e("界面展示-->" + hidden);
    }

    /**
     * 提示吐司
     * @param str
     */
    public void showToast(String str){
        Toast.makeText(getActivity(),str,Toast.LENGTH_SHORT).show();

    }
}
